Skip to content

[Cisco][fboss2] Add sFlow collector configuration CLI - #1969

Closed
prapty wants to merge 2 commits into
meta:mainfrom
prapty:sflow-collector-config-cli
Closed

prapty wants to merge 2 commits into
meta:mainfrom
prapty:sflow-collector-config-cli

Conversation

@prapty

@prapty prapty commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Pre-submission checklist

  • I've ran the linters locally and fixed lint errors related to the files I modified in this PR. You can install the linters by running pip install -r requirements-dev.txt && pre-commit install
  • pre-commit run

Summary

Add fboss2 config sflow-collector <ip> <port> and fboss2 delete sflow-collector <ip> <port> commands for managing sFlow collector tuples through the standard FBOSS config session.

The shared argument type requires exactly one collector IP address and UDP port, accepts IPv4 and IPv6, stores canonical address spellings, and validates the positive range representable by the existing signed i16 collector-port schema.

Adding an existing tuple is idempotent and preserves unrelated collectors. Deletion matches the complete address/port tuple and removes semantically identical entries, including legacy IPv6 spellings, without affecting other collectors.

Changes are staged at the hitless action level and become active only after fboss2 config session commit.

Test Plan

  • pre-commit run --from-ref upstream/main --to-ref HEAD
  • Added focused coverage to fboss2_cmd_config_test for IPv4 and IPv6 parsing, canonicalization, argument and port validation, persistence, idempotent addition, complete-tuple matching, canonical duplicate deletion, and safe handling of missing collectors.
  • Built a downstream G200 FBOSS forwarding stack containing the change and ran all nine CmdConfigSflowCollectorTestFixture tests successfully.
  • Installed a downstream image on a Cisco MORGAN800CC system and verified command registration for both commands.
  • Added, persisted, and deleted an sFlow collector tuple through the staged config session.
  • Verified repeated addition remained idempotent, exact tuple deletion preserved the same address on a different port, and deletion of a missing tuple left existing collectors unchanged.
  • Verified invalid addresses, non-integer and out-of-range ports, and incorrect argument counts were rejected without changing the staged configuration.

Actual sampled-packet delivery to the configured collector was not validated as part of this testing.


Replacement for #1667, which was automatically closed.

@prapty
prapty requested review from a team as code owners November 12, 2026 20:11
@meta-cla meta-cla Bot added the CLA Signed label Nov 12, 2026
@prapty prapty changed the title [Cisco] Add fboss2 sFlow collector configuration CLI [Cisco][fboss2] Add sFlow collector configuration CLI Nov 12, 2026
@github-actions github-actions Bot added cisco project:fboss2 FBOSS project: fboss2 labels Nov 12, 2026
@@ -0,0 +1,112 @@
/*

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@prapty : Can you address the pre-commit action failure?
We recently enforced a new copyright header for any new cpp files. You can find out more from https://github.com/meta/fboss/actions/runs/43297841198/job/131460795732?pr=1969

Add fboss2 config and delete commands for sFlow collector IP and UDP port tuples in the staged agent configuration.

Validate argument arity, canonical IP addresses, and the positive range supported by the existing i16 port schema. Preserve unrelated collectors, make repeated additions idempotent, and remove canonical duplicates on deletion.

Add focused coverage for IPv4, IPv6, validation boundaries, persistence, tuple matching, idempotency, and safe missing-entry behavior.
@prapty
prapty force-pushed the sflow-collector-config-cli branch from e8295d8 to ca036da Compare November 13, 2026 18:09
@meta-codesync

meta-codesync Bot commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

@joseph5wu has imported this pull request. If you are a Meta employee, you can view this in D131864222.

@meta-codesync meta-codesync Bot closed this in 225f9f6 Nov 14, 2026
@meta-codesync meta-codesync Bot added the Merged label Nov 14, 2026
@meta-codesync

meta-codesync Bot commented Nov 14, 2026

Copy link
Copy Markdown
Contributor

@joseph5wu merged this pull request in 225f9f6.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants